﻿package mortal.game.view.rebate.openServerSevenDay
{
    import Framework.Util.*;
    import Message.Game.*;
    import flash.utils.*;
    import mortal.common.error.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class OpenServerSevenDayProxy extends Proxy
    {

        public function OpenServerSevenDayProxy()
        {
            return;
        }// end function

        public function getToplist(param1:int) : void
        {
            rmi.iRankingPrx.getToplist_async(new AMI_IToplist_getToplist(this.ongetTopListSuccess, this.onFail), -1, param1);
            return;
        }// end function

        private function ongetTopListSuccess(param1:AMI_IToplist_getToplist, param2:Array, param3:int) : void
        {
            Cache.instance.openServerSevenDay.toplists = param2;
            NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayGetData, null);
            return;
        }// end function

        public function getToplistDateOff(param1:int) : void
        {
            rmi.iRankingPrx.getToplist_async(new AMI_IToplist_getToplist(this.ongetTopListDateOffSuccess, this.onFail), 0, param1);
            return;
        }// end function

        private function ongetTopListDateOffSuccess(param1:AMI_IToplist_getToplist, param2:Array, param3:int) : void
        {
            Cache.instance.openServerSevenDay.toplists = param2;
            NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayGetData, null);
            return;
        }// end function

        public function getRankToplist(param1:int) : void
        {
            rmi.iRankingPrx.getToplist_async(new AMI_IToplist_getToplist(this.ongetRankTopListSuccess, this.onFail), 0, param1);
            return;
        }// end function

        private function ongetRankTopListSuccess(param1:AMI_IToplist_getToplist, param2:Array, param3:int) : void
        {
            Cache.instance.openServerSevenDay.rankPanelList = param2;
            NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayRankPanelGetData, null);
            return;
        }// end function

        public function getRankToplistDateOff(param1:int) : void
        {
            rmi.iRankingPrx.getToplist_async(new AMI_IToplist_getToplist(this.ongetRankTopListDateOffSuccess, this.onFail), -1, param1);
            return;
        }// end function

        private function ongetRankTopListDateOffSuccess(param1:AMI_IToplist_getToplist, param2:Array, param3:int) : void
        {
            Cache.instance.openServerSevenDay.rankPanelList = param2;
            NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayRankPanelGetData, null);
            return;
        }// end function

        public function getIfCanTakeSevenDaysTargetAward(param1:int) : void
        {
            rmi.iActive.getIfCanTakeSevenDaysTargetAward_async(new AMI_IActive_getIfCanTakeSevenDaysTargetAward(this.checckSuccess, this.onFail), param1);
            return;
        }// end function

        private function checckSuccess(param1:AMI_IActive_getIfCanTakeSevenDaysTargetAward, param2:Dictionary) : void
        {
            Cache.instance.openServerSevenDay.result = param2;
            NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayCheckCanGet, null);
            return;
        }// end function

        public function takeSevenDaysTargetAward(param1:int, param2:int, param3:int) : void
        {
            var getRewardSuccess:Function;
            var type:* = param1;
            var targetType:* = param2;
            var targetLevel:* = param3;
            getRewardSuccess = function (param1:AMI_IActive_takeTargetActiveAward) : void
            {
                Cache.instance.openServerSevenDay.canGet = 0;
                var _loc_2:Object = {};
                _loc_2.type = type;
                _loc_2.targetType = targetType;
                _loc_2.targetLevel = targetLevel;
                NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayGotReward, _loc_2);
                return;
            }// end function
            ;
            rmi.iActive.takeTargetActiveAward_async(new AMI_IActive_takeTargetActiveAward(getRewardSuccess, this.onFail), type, targetType, targetLevel);
            return;
        }// end function

        public function takeTargetAwardById(param1:int) : void
        {
            var getTargetSuccess:Function;
            var t_id:* = param1;
            getTargetSuccess = function (param1:AMI_IActive_takeTargetActiveAwardByID) : void
            {
                Cache.instance.openServerSevenDay.canGetFlag(0, t_id);
                var _loc_2:Object = {};
                _loc_2.t_id = t_id;
                NetDispatcher.dispatchCmd(ServerCommand.OpenServerSevenDayGotReward, _loc_2);
                return;
            }// end function
            ;
            rmi.iActive.takeTargetActiveAwardByID_async(new AMI_IActive_takeTargetActiveAwardByID(getTargetSuccess, this.onFail), t_id);
            return;
        }// end function

        private function onFail(param1:Exception) : void
        {
            MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            return;
        }// end function

        public function getActiveGiftBag(param1:int) : void
        {
            rmi.iActive.getActiveGiftBag_async(new AMI_IActive_getActiveGiftBag(this.getActiveGiftBagSuccess, this.onFail), param1);
            return;
        }// end function

        private function getActiveGiftBagSuccess(param1:AMI_IActive_getActiveGiftBag) : void
        {
            return;
        }// end function

    }
}
